Skip to content

[WIP] Broker CR reconciler#1638

Draft
hidalgopl wants to merge 7 commits into
mainfrom
pb/broker-cr-reconciler
Draft

[WIP] Broker CR reconciler#1638
hidalgopl wants to merge 7 commits into
mainfrom
pb/broker-cr-reconciler

Conversation

@hidalgopl

Copy link
Copy Markdown
Contributor

No description provided.

hidalgopl and others added 3 commits July 2, 2026 14:44
Flesh out the Broker controller to manage pod lifecycle (create, adopt,
shadow), PVC provisioning, status conditions, and broker ID resolution
via the admin API. Pod-mutating actions are gated by the
operator.redpanda.com/roll-grant annotation whose config-checksum must
match the desired pod template checksum, keeping the Broker controller
a dumb executor while the cluster controller serialises rolls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement executeDecommission in the Broker reconciler: check
DecommissionBrokerStatus, initiate if not yet started, block on last
broker (RFC Q2). Add broker-crd.feature acceptance test covering the
full lifecycle: pod adoption from orphan-deleted StatefulSet, roll-grant
gating, broker ID resolution, and decommission to completion.

Temporarily flip --enable-broker and --experimental defaults to true
for testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…roller

Detect checksum drift between desired pod template and running pod.
When a valid roll-grant is held and checksums diverge, enable
maintenance mode on the broker via admin API, then delete the pod so
the next reconcile recreates it from the updated spec. Adoption now
stamps the checksum annotation on the pod to prevent a spurious
delete+recreate cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hidalgopl hidalgopl marked this pull request as draft July 2, 2026 18:49
@secpanda

secpanda commented Jul 2, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

…d finalizer, PV remediation, drain

Restructure BrokerReconciler.Reconcile into a state struct + ordered
sub-reconciler chain matching the RedpandaReconciler style. Add:
- brokerReconciliationState / brokerReconcilerFn types
- Finalizer with decommission-on-delete and rollback-safe removal
- PV node-affinity remediation via pvcunbinder.DeadNodePVCs
- Maintenance mode drain before pod rotation (ensureDrained)
- Post-decommission pod + PVC cleanup
- Broker ID continuity check and maintenance mode disable
- Extended status conditions (PodScheduled, BrokerRegistered,
  ConfigOutdated, StorageBound)
- Roll-grant deadline validation
- Integration test suite and acceptance test steps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hidalgopl hidalgopl force-pushed the pb/broker-cr-reconciler branch from 30834f8 to 44b9c13 Compare July 6, 2026 13:40
…n test

Pre-fetch pod in Reconcile via fetchState instead of inline construction,
making state.pod nil when the pod doesn't exist. Guard reconcilePod and
reconcilePVCs against recreating resources for decommissioned brokers.
Fix TestPVAffinityRemediation to use VolumeClaimTemplates so the
controller can recreate PVCs after remediation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hidalgopl hidalgopl force-pushed the pb/broker-cr-reconciler branch from 44b9c13 to 3137fda Compare July 6, 2026 14:02
hidalgopl and others added 2 commits July 6, 2026 17:25
The Broker controller was defaulting to enabled, but the Broker CRD
isn't in the kustomize overlay that kuttl uses — crashing the operator
on startup and failing all V1 nodepool kuttl tests.

Default to false and explicitly opt in via acceptance test flags.
Also extract shared test setup into setupBrokerCluster helper,
inline newMulticlusterPod (only 2 call sites), and drop unused
Gherkin step parameter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…de cleanup

Add SkipNameValidation to NodePool, Redpanda, and Broker controllers so
multiple test suites can register same-named controllers in one process
without hitting controller-runtime's global metrics name check.

Add t.Cleanup in TestPVAffinityRemediation to restore a deleted k3d node
if the test fails before the in-test replacement, preventing cascading
failures in other tests sharing the k3d cluster.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants